<?php
declare (strict_types = 1);

namespace app\service\basic\auth;

use think\Model;

interface UserProvider
{
    /**
     * Retrieve a user by their unique identifier.
     *
     * @param  mixed  $identifier
     * @return Model
     */
    public function retrieveById($identifier);

    /**
     * Retrieve a user by the given credentials.
     *
     * @param  array  $credentials
     * @return Model
     */
    public function retrieveByCredentials(array $credentials);

    /**
     * Validate a user against the given credentials.
     *
     * @param  Model  $user
     * @param  array  $credentials
     * @return bool
     */
    public function validateCredentials($user, array $credentials);

    /**
     * Validate a user state.
     *
     * @param Model $user
     * @return bool
     */
    public function validateState($user);
}
